package com.pingba.serviceImpl.friend;

import com.pingba.dao.BaseDao;
import com.pingba.dao.friend.BlackLIstDao;
import com.pingba.entity.User;
import com.pingba.entity.friend.BlackList;
import com.pingba.service.friend.BlackListService;
import com.pingba.serviceImpl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2016/1/1 0001.
 */
@Service("blackListServie")
public class BlackListServiceImpl extends BaseServiceImpl<BlackList, Long> implements BlackListService {

    @Autowired
    private BlackLIstDao blackListDao;
    @Override
    public BaseDao<BlackList, Long> getDao() {
        return blackListDao;
    }

    /**
     * @see
     * @param blackList 封装了数据的vo对象，mybatis直接操作
     */
    @Override
    public void igoreUser(BlackList blackList) {
        if (!isIgnored(blackList)) {
            blackListDao.igoreUser(blackList);
        }

    }

    @Override
    public List<User> myBlackLists(User user) {
        return blackListDao.myBlackLists(user);
    }

    @Override
    public void recoverUser(BlackList blackList) {
         blackListDao.recoverUser(blackList);
    }

    @Override
    public boolean isIgnored(BlackList blackList) {
        if (blackListDao.isIgnored(blackList) == null) {
            return false;
        }
        return true;
    }
}
